<?php

namespace app\site\controller\store;

use app\common\exception\MiException;
use app\model\store\GoodsReply;
use app\site\controller\AController;
use app\site\controller\traits\CurdTrait;
use app\site\service\reqService;
use app\site\service\RequestService;
use app\site\service\SiteReqService;
use app\site\service\store\GoodsReplyService;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Request;
use think\response\Json;

class GoodsReplyController extends AController
{

    /**
     * @throws DbException
     */
    public function index(){
        return $this->reqSer->setService(GoodsReplyService::instance())->setPaginate()->getResponse();
    }

    /**
     * @throws MiException
     */
    public function add(){
        return $this->reqSer->setService(GoodsReplyService::instance())->add()->getResponse();
    }

    /**
     * @throws DataNotFoundException
     * @throws ModelNotFoundException
     * @throws DbException
     * @throws MiException
     */
    public function edit(\app\Request $request){
        if($request->isPost()){
            return $this->reqSer->setService(GoodsReplyService::instance())->edit()->getResponse();
        }else{
            return $this->reqSer->setService(GoodsReplyService::instance())->setFind()->getResponse();
        }
    }

    /**
     * @throws DataNotFoundException
     * @throws ModelNotFoundException
     * @throws DbException
     * @throws MiException
     */
    public function del(){
        return $this->reqSer->setService(GoodsReplyService::instance())->delete()->getResponse();
    }

}
